package sy5_1;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Demo1 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("input number1,number2:");
       try {
        int number1 = input.nextInt();
        int number2 = input.nextInt();
        if (number2==0) throw new ArithmeticException("除数不能为0!");
        int result = number1 / number2;
        System.out.println("result:" + result);
       }catch (InputMismatchException e){
           System.out.println("请输入数字");
       }catch (ArithmeticException e){
           //System.out.println("除数不能为0");
           System.out.println(e.getMessage());
       }catch (Exception e){
           System.out.println("其他异常");
       }finally {
           input.close();
           System.out.println("程序关闭");
       }
    }
}
